<template>
    <div class="t5">
        <div class="t5Title">
            {{name}}
        </div>
        <div class="contBox">
            <div class="cont">
                <div class="item" v-for="(item,i) in contData" :key="i">
                    <img v-lazy="item.vertical_cover" alt="">
                    <div class="name">{{item.title}}</div>
                    <div class="time">{{item.release_time|time}}</div>
                    <div class="but" @click="gotoCartoon(item)">
                        <span>想看</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props:['id','name'],
        data() {
            return {
                contData:{},
            }
        },
        created(){
            this.axios({
                url:'GetClassPageSixComics',
                params:{
                    id:this.id,
                    pageNum:1,
                    pageSize:6,
                    isAll:0,
                }
            }).then(res =>{
                if (res.status === 200) {
                    this.contData = res.data.data.roll_six_comics
                }
            })
        },
        filters:{
            time(v){
                let time = new Date(v)
                return (time.getMonth()+1)+'月'+time.getDate()+'日'
            }
        },
        methods:{
            gotoCartoon(item){
                
                this.$router.push({name:"CartoonContainer",query:{id:item.comic_id}})
            }

        }
    }
</script>

<style lang="less" scoped>
    .t5{
        margin-top: 20px;
        padding: 0 10px;
        box-sizing: border-box;
        .t5Title{
            font-size: 16px;
            font-weight: 600;
        }
        .contBox{
            width: 100%;
            margin-top: 10px;
            .cont{
                white-space:nowrap;
                overflow-y: auto;
                .item{
                    width: 100px;
                    display: inline-block;
                    margin-right: 10px;
                    img{
                        width: 100%;
                        display: block;
                        border-radius: 5px;
                    }
                    .name{
                        line-height: 25px;
                        text-align: center;
                        text-overflow: ellipsis;
                        white-space: nowrap;
                        overflow: hidden;
                    }
                    .time{
                        line-height: 20px;
                        text-align: center;
                        color: #91939b;
                    }
                    .but{
                        width: 100%;
                        text-align: center;
                        span{
                            line-height: 25px;
                            padding: 5px 25px;
                            border-radius: 25px;
                            background-color: #58a7f8;
                            color: white;
                        }
                    }
                }
            }
        }
    }
</style>